<?php 

	/**
	 * @description  评论相关
	 * @author 	shiweifxdr
	 * @date  	
	 */

	_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );

	// Do not delete these lines
	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');

	if ( post_password_required() ) { ?>
		<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.'); ?></p>
	<?php
		return;
	}
	$user = $_SESSION['userdata'];

	echo "<!-- // comment here start  -->" ;
	echo "<div id='hengtiao'>".
		"	<img src='";
	bloginfo('template_url');
	echo "/images/hpleft.jpg' height='35' style='float:left;' />".
		"		<ul>".
      	"			<li style='float:left;'>游戏评论</li>".
        "            <li style='float:right;'>当前共有";
	$comment_count = get_comment_count($post->ID);
	
	echo $comment_count['total_comments'];

	echo "条评论</li>".
        "       </ul>".
		"	<img src='";
	bloginfo('template_url');
	echo "/images/hpright.jpg' height='35' style='float:right;' />".
		"</div>" ; 
	echo "<ol class='commentlist'>" ;
	wp_list_comments('type=comment&callback=mytheme_comment&per_page=15'); 
	
?>
<script type="text/javascript">
	var commentform = null ;

	function commit_comment(){
		var form = document.getElementById('comment_form') ;
		form.submit();
	}

	function submitCom(data){
		eval('var obj = ' + data + ''); 
  		$('#author').val(obj.display_name) ;
  		$('#email').val(obj.user_email) ;
  		submitComment(obj.display_name) ;
	}
	
	
	function submitComment(displayname){
		if(commentform ==null ){
			commentform = document.getElementById('comment_form') ;
		}
		if(displayname==null || ""==displayname){
			displayname = $('#author').val() ;
		}
		if(displayname!=null && ""!=displayname){
			commentform.submit();
		}else {
			opWin("submit_bt");
			loginCallBack = submitCom;
		}
		return false ;
	}
</script>
	<?php echo "</ol>" ;?>
	
	<div style="float:left;  display:inline;">
		<div class="alignleft"><?php previous_comments_link('上一页') ?></div>
		<div class="alignright"><?php next_comments_link('下一页') ?></div>
	</div>
             <div id="hengtiao">
            	<img src="<?php bloginfo('template_url');?>/images/hpleft.jpg" height="35" style="float:left;" />
                <ul>
                	<li style="float:left;">发表评论</li>
                </ul>
                <img src="<?php bloginfo('template_url');?>/images/hpright.jpg" height="35" style="float:right;" />
            </div>
            <div id="fbping">
            	<form id="comment_form" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" >
                	<textarea name="comment" id="comment" 
                	style="float:left; width:653px; min-height:135px; margin-left:5px; display:inline; background:url(http://www.youxisoso.com/wp-content/themes/youxisoso/images/textareabg.jpg) no-repeat; border:#b5b8c9 solid 1px;" ></textarea>
                  <input type="hidden" id="email" name="email" value="<?php echo $user->user_email; ?>"  />
               	  <input type="hidden" id="author" name="author"  value="<?php echo $user->display_name; ?>"  />
                  <input type="hidden" id="comment_approved" name="comment_approved"  value="1"  />
                  
                   <!-- 
                    <label for="author" >用户名:</label>
                    <input type="text" id="author" name="author"  value="<?php //echo esc_attr($comment_author); ?>"  class="userpass" />
                    <label for="email">邮箱:</label>
                    <input type="text" id="email" name="email" value="<?php //echo esc_attr($comment_author_email); ?>" class="userpass" />
                    <span class="sid_cont"><a href="#">忘记密码</a></span>
                    <span class="sid_cont"><a href="#">注册</a></span> -->
                    
                    <input  style="font-size:12px; font-weight:normal; margin:5px 0 0 3px;background:url(http://www.youxisoso.com/wp-content/themes/youxisoso/images/bottom_bg.gif) no-repeat; width:84px; height:26px; border:none; cursor:pointer; color:#fff; font-size:12px; font-weight:bold;" name="submit_button" class="inputstyle03"  type="submit" id="submit_bt" value="发送"  onclick="return submitComment('<?php echo $user->display_name;?>');" />
                    <span id="pl_jie"></span>
                    <?php comment_id_fields(); ?>
					<?php do_action('comment_form', $post->ID); ?>
                </form>
            </div>
<?php 
	echo "<!-- // comment here end  -->" ;
	//$_SESSION['userdata']=null;
?>


<?php	//comments_template(); ?> 